
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<%@ include file="/WEB-INF/jsp/include/page_header.jspf" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<link rel="stylesheet" href="${pageContext.request.contextPath}/css/style.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/css/slide.css" type="text/css" media="screen" />
<link href="${pageContext.request.contextPath}/css/sm.css" rel="stylesheet" type="text/css"/>
<script type='text/javascript' src='${pageContext.request.contextPath}/js/jquery-1.5.2.min.js'></script>
<script type='text/javascript' src='${pageContext.request.contextPath}/js/jquery-ui-1.8.17.custom.min.js'></script>
<script src="${pageContext.request.contextPath}/js/jquery.form.js" type="text/javascript"></script>
<script type="text/javascript">          

                       
    function save(event, f, idPengguna)
    {
        var q = $(f).formSerialize();      
        var url = f.action + '?' + event+'&idPengguna='+idPengguna ;          
        $.post(url,q,
        function(data){
            $('#page_div',opener.document).html(data);
            self.close();
        }, 'html');

    }
    
      function removePeranan (val,val2) {
            form = document.form1;
            var answer = confirm("Delete?");
            if (answer) {
                form.action = '${pageContext.request.contextPath}/uam_register?deletePeranan&idPengguna='+val+'&peranan=' + val2;
                form.submit();
            }
        }
            
    
</script>
</head>

<s:useActionBean beanclass="ipfms.stripes.util.ListUtil" var="list"/>
<s:form beanclass="ipfms.stripes.action.RegisterUserActionBean" name="form1">
    <s:messages />
    <s:errors />
        <table width="50%"  align="center" border="0" cellpadding="1" cellspacing="0" class="normaltext" bgcolor="F7F7F6">
            <tr>
                <td colspan="3"><img src="${pageContext.request.contextPath}/images/1_1_empty.gif" width="50" height="8"></td>
            </tr>
            <tr bgcolor="8dc73f">
                <td width="20"><img src="${pageContext.request.contextPath}/images/1_1_empty.gif" width="10" height="1"></td>
                <td width="226"  bgcolor="8dc73f" class="boldwhite">ADD ROLE </td>                            
                <td width="10" class="boldwhite"><img src="${pageContext.request.contextPath}/images/1_1_empty.gif" width="10" height="1"></td>
            </tr>
            <td>&nbsp;</td>
            <tr>
                <td style="text-align: right">User ID</td>
                <td>:  ${actionBean.p.idPengguna}                     
                    <s:hidden name="pp.pengguna" value="${actionBean.p.idPengguna}" />
                </td>                                
            </tr> 
            <tr><td  style="text-align: right">User Role :</td>
                <td>
                    <s:select name="pp.peranan.code">           
                        <s:option value="">Choose One</s:option>
                        <s:options-collection collection="${list.senaraiJenisPengguna}" label="desc" value="code"/>
                    </s:select>                                               
                </td></tr>
            <tr><td colspan="2">
                    <div align="center">
                        <s:button name="addRole" value="Add" class="btn" onmouseover="this.style.cursor='pointer';" onclick="save(this.name,this.form, '${actionBean.p.idPengguna}')"/>
                        <s:button name="tutup" value="Close" onclick="javascript:self.close()"/>
                    </div>
                </td></tr>
            <tr>
                <td>
                    <div class="left_entry"><div class="left_title">List Of User Role</div>
                        <display:table class="tablecloth" style="width:100%; border:0px;  bordercolor:#BBB;" name="${actionBean.senaraiPgunaPeranan}" pagesize="10"
                                       cellpadding="0" cellspacing="0" id="line"
                                       requestURI="/uam_register">
                            <display:column title="No" sortable="true" style="vertical-align:baseline">${line_rowNum}</display:column>
                            <display:column property="pengguna.idPengguna" title="User ID" style="vertical-align:baseline"/>
                            <display:column title="User Role">
                                <input type='hidden' name="" id="kodPguna_${line_rowNum-1}" value="${line.peranan.code}"/>
                                ${line.peranan.desc}
                            </display:column>
                            <display:column title="Delete">
                                <p align="center">
                                    <img alt='Klik Untuk Hapus' border='0' src='${pageContext.request.contextPath}/images/not_ok.gif' 
                                         onclick="removePeranan('${line.pengguna.idPengguna}','${line.peranan.code}')" onmouseover="this.style.cursor='pointer';">
                                </p>
                            </display:column>
                        </display:table>
                    </div>  
                </td>
            </tr>
        </table>

        <br>
</s:form>
